﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CNVP.JShop.Web.Admin.CommonWindows
{
    public partial class AjaxCity : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["Code"]))
            {
                string html = "";
                string Code_Str = Request.QueryString["Code"];
                string Type_Str = Request.QueryString["Type"];
                switch (Type_Str)
                {
                    case "ProvinceID":
                        IList<Model.CNVP_City> model_City = new BLL.CNVP_City().GetAll_CNVP_City(Code_Str);
                        html = "<select name=\"ListCity\" onchange=\"CityChange()\" id=\"ListCity\" >";
                        html += "<option value=\"\">--请选择--</option>";
                        foreach (Model.CNVP_City c in model_City)
                        {
                            html += "<option value=\"" + c.Code + "\">" + c.Name + "</option>";
                        }
                        html += "</select>";
                        Response.Write(html);
                        break;
                    case "CityID":
                        IList<Model.CNVP_Area> model_Area = new BLL.CNVP_Area().GetAll_CNVP_Area(Code_Str);
                        html = "<select name=\"ListArea\" id=\"ListArea\" >";
                        html += "<option value=\"\">--请选择--</option>";
                        foreach (Model.CNVP_Area a in model_Area)
                        {
                            html += "<option value=\"" + a.Code + "\">" + a.Name + "</option>";
                        }
                        html += "</select>";
                        Response.Write(html);
                        break;
                }
                
            }
        }
    }
}